<template>
  <!-- <el-table
    :data="tableData"
    border
    style="width: 100%"
    stripe
    @selection-change="handleSelectionChange"
  >
    <el-table-column type="selection" width="55"></el-table-column>
    <el-table-column prop="id" label="工号" width="180" sortable></el-table-column>
    <el-table-column prop="name" label="姓名" width="180" sortable></el-table-column>
    <el-table-column prop="phone" label="联系电话" sortable></el-table-column>
    <el-table-column prop="gender" label="性别" sortable></el-table-column>
    <el-table-column prop="dept" label="所在部门" sortable></el-table-column>
    <el-table-column fixed="right" label="操作" width="150">
      <template slot-scope="scope">
        <el-button @click="view(scope.row)" type="text" size="small">查看</el-button>
        <el-button @click="edit(scope.row)" type="text" size="small">编辑</el-button>
        <el-button @click="deleteItem(scope.row)" type="text" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>-->
  <h4>{{ msg }}</h4>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      msg: '',
      tableData: [
        {
          id: '0000',
          name: 'admin',
          phone: '10086',
          gender: '女',
          dept: '总部'
        },
        {
          id: '0001',
          name: '小一',
          phone: '10086',
          gender: '女',
          dept: '采购部'
        },
        {
          id: '0002',
          name: '小二',
          phone: '10086',
          gender: '男',
          dept: '市场部'
        },
        {
          id: '0003',
          name: '小三',
          phone: '10086',
          gender: '女',
          dept: '库管部'
        },
        {
          id: '0004',
          name: '小四',
          phone: '10086',
          gender: '男',
          dept: '采购部'
        },
        {
          id: '0005',
          name: '小五',
          phone: '10086',
          gender: '女',
          dept: '采购部'
        },
        {
          id: '0006',
          name: '小六',
          phone: '10086',
          gender: '女',
          dept: '库管部'
        },
        {
          id: '0007',
          name: '小七',
          phone: '10086',
          gender: '男',
          dept: '采购部'
        },
        {
          id: '0008',
          name: '小八',
          phone: '10086',
          gender: '女',
          dept: '库管部'
        },
        {
          id: '0009',
          name: '小九',
          phone: '10086',
          gender: '男',
          dept: '市场部'
        },
        {
          id: '0010',
          name: '小十',
          phone: '10086',
          gender: '女',
          dept: '采购部'
        }
      ],
      multipleSelection: []
    }
  },
  created: function () {
    axios({
      method: 'get',
      url: '/api/test/test'
      // headers: {
      //   'Content-Type': 'application/x-www-form-urlencoded'
      // }
    })
      .then(result => {
        if (!result.status === 200) {
          this.msg = result.data.message
        }
        this.msg = result.data.message
      })
      .catch(err => {
        this.msg = err.data.msg
      })
  },
  methods: {
    toggleSelection (rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row)
        })
      } else {
        this.$refs.multipleTable.clearSelection()
      }
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    view (row) {
      console.log(row)
    },
    edit (row) {
      console.log(row)
    },
    deleteItem (row) {
      console.log(row)
    }
  }
}
</script>
